package com.io.stream.iochar;

import com.io.stream.IoParam;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.Reader;
import java.io.Writer;

public class IoChar01 {
    public static void main(String[] args) throws Exception {
        // 读文本 写文本
        File readerFile = new File(IoParam.BASE_PATH+"io-text.txt") ;
        File writerFile = new File(IoParam.BASE_PATH+"copy-"+readerFile.getName()) ;
        // 字符输入输出流
        Reader reader = new FileReader(readerFile) ;
        Writer writer = new FileWriter(writerFile) ;
        // 字符读入和写出
        int readSign ;
        while ((readSign = reader.read()) != -1){
            writer.write(readSign);
        }
        writer.flush();
        // 关闭流
        writer.close();
        reader.close();
    }
}
